#include"calcLite.h"


void menu()
{
  printf("\n");
  printf("0.退出\n");
  printf("1.加法\n");
  printf("2.减法\n");
  printf("3.乘法\n");
  printf("4.除法\n");
  printf("5.求余\n");
  printf("\n");
}

int main()
{
  int input = 1;
  //函数指针数组
  int (*pfun[6])(int, int) = {NULL, Add, Sub, Mul, Div, Rem}; 
  while(input)
  {
    menu();
    printf("请选择:>");
    scanf("%d", &input);
    switch(input)
    {
      case 0:
        printf("退出计算器青春版\n");
        break;
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
        printf("请输入两个数:>");
        int x, y;
        scanf("%d %d", &x, &y);
        int val = pfun[input](x, y);
        printf("计算结果为:%d\n", val);
        break;
      default:
        printf("选择错误，请重新选择!\n");
        break;
    }
  }
  return 0;
}
